* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #root {
  margin: 0;
  padding: 0;
}

/* 主容器 */
.latex-tool-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #333;
}

/* 公式按钮网格 */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  padding: 10px;
  background: #f8f8f8;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.formula-btn {
  padding: 8px 4px;
  border: 1px solid #d0d0d0;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  outline: none;
}

.formula-btn:hover {
  border-color: #0066cc;
  background: #f0f7ff;
  box-shadow: 0 2px 4px rgba(0, 102, 204, 0.12);
}

.formula-btn:active {
  background: #e6f0ff;
}

/* 输入框 */
.latex-input {
  border: none;
  border-bottom: 1px solid #e0e0e0;
  padding: 10px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  resize: none;
  outline: none;
  background: #fff;
  line-height: 1.4;
  height: 85px;
  flex-shrink: 0;
}

.latex-input:focus {
  background: #fafafa;
}

/* 预览区 */
.preview-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
}

.preview-label {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #999;
  background: #f0f0f0;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.preview-content {
  padding: 12px;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  font-size: 15px;
  line-height: 1.6;
  flex: 1;
  min-height: 0;
}

/* 响应式调整 */
@media (max-width: 700px) {
  .formula-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    padding: 8px;
  }

  .formula-btn {
    min-height: 40px;
    padding: 6px 3px;
    font-size: 11px;
  }
}

@media (max-width: 600px) {
  .formula-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 6px;
  }

  .formula-btn {
    min-height: 38px;
    padding: 5px 3px;
    font-size: 10px;
  }

  .latex-input {
    height: 80px;
    padding: 8px;
    font-size: 11px;
  }

  .preview-content {
    padding: 10px;
    font-size: 13px;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* 保留原有样式 */
.App {
  text-align: center;
}

.App-logo {
  height: 40vmin;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .App-logo {
    animation: App-logo-spin infinite 20s linear;
  }
}

.App-header {
  background-color: #282c34;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: calc(10px + 2vmin);
  color: white;
}

.App-link {
  color: #61dafb;
}

@keyframes App-logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}